fix: make ziglint self-lint clean#3
Conversation
|
Warning Review limit reached
More reviews will be available in 9 minutes and 12 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more credits in the billing tab to continue. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (9)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Pull request overview
This PR updates ziglint’s internals and fixtures for Zig 0.16 API changes and restores the project’s “self-lint smoke” step to expect a clean (exit code 0) run, ensuring ziglint can lint its own source without findings.
Changes:
- Update Zig stdlib string search calls from
std.mem.indexOf*/indexOfPosto Zig 0.16std.mem.find*/findPos. - Standardize allocator/I/O parameter ordering (notably
ModuleGraph.initandConfig.load) and update call sites/tests accordingly. - Expand recognition of Zig 0.16 builtin type-constructor builtins for type-expression/type-alias detection in the linter, updating related tests and enabling self-lint to require exit code 0.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/TypeResolver.zig | Updates number-literal parsing to Zig 0.16 std.mem.find APIs; updates ModuleGraph.init call ordering in tests. |
| src/rules.zig | Switches rule message context parsing to std.mem.findScalar for Zig 0.16. |
| src/ModuleGraph.zig | Reorders init parameters to (allocator, io, ...) and updates tests accordingly. |
| src/main.zig | Aligns argument ordering (detectColorSupport, FileConfig.load, loadGitignore, ModuleGraph.init) and updates string searches to find/findPos. |
| src/Linter.zig | Adds builtin type-constructor recognition helper, uses it for type-expression/alias checks, and updates related fixtures/tests to Zig 0.16-style constructors. |
| src/doc_tests.zig | Updates markdown parsing searches to find/findPos and adjusts ModuleGraph.init call ordering. |
| src/Config.zig | Reorders load/config-discovery function parameters to (allocator, io, ...) and updates internal call sites. |
| build.zig | Restores self-lint smoke to expect exit code 0, keeping it in the test aggregate. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Code Review Roast 🔥Verdict: 2 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)
🏆 Best part: The Zig 0.16 migration is thorough - all those 💀 Worst part: The 📊 Overall: Like a buffet that looks great but contains rat poison - the migration is solid but two poison pills snuck in. Files Reviewed (8 files)
Reviewed by nex-n2-pro:free · 175,942 tokens |
WHY: Two Kilo review nits questioned whether @EnumLiteral (Linter.zig:1099) and @tuple (Linter.zig:1105) belong in the builtin type-constructor list. Verified against the Zig 0.16 langref shipped with the compiler: both are documented type-constructor builtins returning `type` (§@EnumLiteral -> '@EnumLiteral() type', §@tuple -> '@tuple(comptime field_types: []const type) type'), confirmed in the builtin TOC and resolved by the live 0.16 compiler. The nits are false positives; removing the entries would regress isTypeExpression for those aliases. WHAT: - Add an in-code rationale comment next to @EnumLiteral/@tuple documenting their langref provenance so the entries are not re-flagged. - Ignore .zig-global-cache/ (project-local global cache dir) in .gitignore. IMPACT: src/Linter.zig (isBuiltinTypeConstructor comment only; no behavior change), .gitignore. Self-lint gate stays clean. VALIDATION: mise x zig@0.16.0 -- zig build test --summary all -> 7/7 steps, 274/274 tests pass, including zig fmt and the lint_smoke self-lint gate at expectExitCode(0). Self-lint on 'src build.zig' emits zero findings, exit 0.
Summary
Validation